<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
}  
include '../../operations/connection.php';
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../../value/value_en.php";
} else if($lang == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}

$page=$_REQUEST['page'];

$rows_per_page = 10 ;
$page_start = ( $page - 1 ) * $rows_per_page; 
$page_end = $page * $rows_per_page;

$sqlpartner = mysql_query("SELECT am.PartnerID,am.PartnerName,am.DomainName,am.DatabaseName,am.Phone,am.Email,am.Website,am.`Status`
		FROM `ac_eli_manager` am WHERE am.Role=2 and am.`Status` !=3; ");
$number_of_page = ceil ( mysql_num_rows( $sqlpartner ) / $rows_per_page ); 


?>

<form action="#" name="formCheck" method="post">
				<table id="listRequest" class="rf-dt" style="width: 100%;">
					<thead class="rf-dt-thd">
						<tr class="rf-dt-shdr">
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 3%; font-size: 12px;">
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 20%; font-size: 12px;"><?php echo $l_doitac?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 15%; font-size: 12px;"><?php echo $l_domainame?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 13%; font-size: 12px;"><?php echo $l_databasename?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 9%; font-size: 12px;"><?php echo $l_phone?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 15%; font-size: 12px;"><?php echo $l_email?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 15%; font-size: 12px;"><?php echo $l_Website?>
							</th>
							<th class="rf-dt-shdr-c" scope="col"
								style="background-color: #eeeeee; width: 23%; font-size: 12px;"><?php echo $l_status?>
							</th>
						</tr>
						<?php
						if(mysql_num_rows($sqlpartner)>0){
							$i=0;
							while ($row = mysql_fetch_array($sqlpartner)){
								if ( $i >= $page_start ){
									?>
						<tr>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 3%; font-weight: normal; font-size: 12px;">
								<input type="checkbox" name="checkname"
								id="<?php echo 'checkcus'.$i?>"
								onclick="processCheck(this.id,document.formCheck.checkname);"
								value="<?=$row[PartnerID]?>" />
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 20%; font-weight: normal; font-size: 12px;"><?php echo $row[PartnerName]?>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 15%; font-weight: normal; font-size: 12px;">
								<a href="<?php echo "http://".$row[DomainName]?>" target="_blank"><?php echo $row[DomainName]?></a>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 13%; font-weight: normal; font-size: 12px;"><?php echo $row[DatabaseName]?>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 9%; font-weight: normal; font-size: 12px;"><?php echo $row[Phone]?>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 15%; font-weight: normal; font-size: 12px;"><?php echo $row[Email]?>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 15%; font-weight: normal; font-size: 12px;">
								<a href="<?php echo "http://".$row[Website]?>" target="_blank"><?php echo $row[Website]?></a>
							</td>
							<td class="rf-dt-shdr-c" scope="col"
								style="background-color: #ffffff; width: 23%; font-weight: normal; font-size: 12px;">
								<?php if($row[Status]==2){ echo $l_danghoatdong;}else{echo $l_ngunghoatdong;}?>
							</td>
						</tr>
						<?php
								}
								$i++;
								if ($i >= $page_end){
									break;
								}
							}
						}
						?>

<tr>
						<td colspan="8" class="rf-dt-shdr-c">
							<span style="background:#fff; padding:1px; display: inline-block;">
														
								<?php if ( $number_of_page > 1 ) 
								{ 
									if ($page==1)
										$p=2;
									else if ($page==$number_of_page)
										$p=$number_of_page-1;
									else $p=$page;
									if($page!=1){?>
										<a onclick="pagingcomp(1);" ><span class='button_next'><?php echo "<<<";?></span> </a>
										<a onclick="pagingcomp(<?=($page-1)?>);" ><span class='button_next'><?php echo "<<";?></span> </a>
									<?php  }
									else{
										echo "<span class='button_next'><<<</span> "; 
										echo "<span class='button_next'><<</span> ";
									}
									for ( $i = $p-1; $i <= $p+1; $i++ ) {	
											if ($i<=$number_of_page && $i>0)
											
												if ($i==$page){
													echo "<span class='button_next'><b>".$i."</b></span>"; 
												}else{
												?>
													<a onclick="pagingcomp(<?=$i?>);" ><span class="button_next">
													<?php 
													echo $i;
													?>
													</span> </a>
													<?php 
												}
											?>
										
									<?php 
											}
										
										if($page!=$number_of_page){ ?>
											<a onclick="pagingcomp(<?=($page+1)?>);"><span class='button_next'><?php echo ">>";?></span> </a>
											<a onclick="pagingcomp(<?=($number_of_page)?>);" ><span class='button_next'><?php echo ">>>";?></span> </a>
										<?php }
										else{
											echo "<span class='button_next'>>></span> ";
											echo "<span class='button_next'>>>></span> ";
										}
									}
								
									
									?>
																						
							</span>
						</td>
					</tr>
					</thead>
				</table>
			</form>